package com.doit.day06

object _02_特质 {
  def main(args: Array[String]): Unit = {

    val laifu: Dog1 = new Dog1
    laifu.eat()
    laifu.sleep()
    laifu.lookDoor()

    //给某一个对象单独赋予了飞的功能 =》scala特质中的动态混入
    val xiaoTianDog: Dog1 with Fly = new Dog1 with Fly {
      override def fly(): Unit = println("fei")
    }
    xiaoTianDog.fly()

  }

}


class Fu1()

class Dog1 extends Eat{
  override def eat(): Unit =println("chi")

  override def sleep(): Unit = println("shui")

  override def lookDoor(): Unit = println("kanjia")

}


